int search(int* nums, int numsLen, int target) {
    int right, lift, mid;
    right = numsLen - 1;
    lift = 0;
    mid = (lift + right) / 2;

    while (lift <= right) {
        if (nums[mid] > target) {
            right = mid - 1;
        }
        else if (nums[mid] < target) {
            lift = mid + 1;
        }
        else
            return mid;
        mid = (lift + right) / 2;
    }
    return -1;
}